﻿<?php
class test{
    private $name="11111";

    public function __get($name1){
        echo "--------"."<br>";                 //相当于$this->name(实参的值为name传给形参$name1)
        return $this->$name1."<br>";
    }

    public function __set($name2,$value){
        echo "======"."<br>";
        return $this->$name2=$value."<br>";
    }
}



$p = new test();

echo $p->name;

echo $p->name="2222222";
?>